# Copyright (c) 2020 cgsdfc
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
"""
Get the correct Python.asdl file according to python version.
"""

from pathlib import Path

DATA_DIR = Path(__file__).parent / 'data'


def GetPythonAsdlFileFromVersion(major, minor):
    return DATA_DIR / 'Python{}.{}.asdl'.format(major, minor)


def GetPythonAsdlFileFromSys():
    from sys import version_info
    print(version_info)

    file = GetPythonAsdlFileFromVersion(major=version_info.major,
                                        minor=version_info.minor)
    if not file.is_file():
        raise FileNotFoundError(str(file))
    print(file)
    return str(file)
